package com.demo.feign.consumer.controller;

import com.demo.feign.api.hello.HelloService;
import com.demo.feign.api.hello.domain.Hello;
import com.demo.feign.consumer.service.FeignHelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class HelloController {

    @Autowired
    FeignHelloService feignHelloService;

    @GetMapping(value = "/hello1")
    public String hello1(){
        return feignHelloService.hello();
    }
    @GetMapping(value ="/hello2" )
    public String hello2(){
        StringBuffer sb = new StringBuffer();
        sb.append(feignHelloService.hello()).append(" \n");
        sb.append(feignHelloService.hello("test")).append("\n");
        sb.append(feignHelloService.hello("test",26)).append(" \n");
        sb.append(feignHelloService.hello(new Hello("test",27))).append("\n");
        log.info("resp:{}",sb.toString());
        return sb.toString();
    }



}
